using Autofac;
using IceCS.Autofac.Core;
using System;
using Xunit;

namespace IceCS.Autofac.xUnit
{
    public class UnitTest1
    {
        [Fact]
        public void Test1()
        {
            OC.Configure();
            using (var scope = OC.Container.BeginLifetimeScope())
            {
                var output = scope.ResolveOptional<ConsoleOutput>();
                var output2 = scope.Resolve<IOutput>();
                var dateWriter1 = scope.Resolve<IDateWriter>();
                var dateWriter2 = scope.Resolve<TodayWriter>();

                Assert.Null(output);
                Assert.NotNull(output2);
                Assert.NotNull(dateWriter1);
                Assert.NotNull(dateWriter2);
            }
        }
    }
}
